<template>
  <el-dialog
      :title="!dataForm.id ? '新增' : '修改'"
      :close-on-click-modal="false"
      @close="formReset"
      :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
             label-width="120px">
      <el-row span="10">
        <el-col :span="12">
          <el-form-item label="样品编码" prop="productNumber">
            <template>
              <el-select v-model="dataForm.productNumber" :disabled="dataForm.id != 0" placeholder="请选择" @change="getProductInfo()">
                <el-option
                    v-for="item in options"
                    :key="item.prProjectNumber"
                    :label="item.prProjectName"
                    :value="item.prProjectNumber">
                </el-option>
              </el-select>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品名称" prop="productName">
            <el-input v-model="dataForm.productName" placeholder="样品编码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品型号" prop="sampleType">
            <el-input v-model="dataForm.sampleType" placeholder="样品型号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="生产者名称" prop="producerName">
            <template>
              <el-select v-model="dataForm.producerName" placeholder="请选择" @change="getEntrepreneurInfo()  ">
                <el-option
                    v-for="item in eoptions"
                    :key="item.id"
                    :label="item.name"
                    :value="item.name">
                </el-option>
              </el-select>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="注册地址" prop="registeredAddress">
            <el-input v-model="dataForm.registeredAddress" placeholder="注册地址"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品数量" prop="sampleNum">
            <el-input v-model="dataForm.sampleNum" placeholder="样品数量"></el-input>
          </el-form-item>
        </el-col>
        <br/>
        <el-col :span="12">
          <el-form-item label="生产厂名称" prop="manufactoryName">
            <template>
              <el-select v-model="dataForm.manufactoryName" placeholder="请选择" @change="getEntrepreneurInfo()  ">
                <el-option
                    v-for="item in eoptions"
                    :key="item.id"
                    :label="item.name"
                    :value="item.name">
                </el-option>
              </el-select>
            </template>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品编号" prop="sampleBernum">
            <el-input v-model="dataForm.sampleBernum" type="textarea" rows="3" placeholder="样品编号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品注册地址" prop="registeredAddressSample">
            <el-input v-model="dataForm.registeredAddressSample" placeholder="样品注册地址"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品生产日期" prop="productionDate">
            <el-date-picker style="width: 135px"
                            v-model="dataForm.productionDate"
                            type="datetime"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期时间">
            </el-date-picker>
          </el-form-item>
          <!--          <el-form-item label="样品生产日期" prop="productionDate">-->
          <!--            <el-input v-model="dataForm.productionDate" placeholder="样品生产日期"></el-input>-->
          <!--          </el-form-item>-->
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品等级" prop="sampleGrade">
            <el-input v-model="dataForm.sampleGrade" placeholder="样品等级"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品取样方式" prop="sampleAcqMethod">
            <el-input v-model="dataForm.sampleAcqMethod" placeholder="样品取样方式"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="抽样基数" prop="samplingBasicNumber">
            <el-input v-model="dataForm.samplingBasicNumber" placeholder="抽样基数"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="抽/供样日期" prop="issueDate">
            <el-date-picker style="width: 135px"
                            v-model="dataForm.samplingBasicDate"
                            type="datetime"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期时间">
            </el-date-picker>
          </el-form-item>
          <!--          <el-form-item label="抽样日期" prop="samplingBasicDate">-->
          <!--            <el-input v-model="dataForm.samplingBasicDate" placeholder="抽样日期"></el-input>-->
          <!--          </el-form-item>-->
        </el-col>
        <el-col :span="12">
          <el-form-item label="抽样地点" prop="samplingBasicPlace">
            <el-input v-model="dataForm.samplingBasicPlace" placeholder="抽样地点"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="验样日期" prop="samplingBasicdate">
            <el-date-picker style="width: 135px"
                            v-model="dataForm.samplingBasicdate"
                            type="datetime"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期时间">
            </el-date-picker>
          </el-form-item>
          <!--          <el-form-item label="到样时间" prop="arriveDate">-->
          <!--            <el-input v-model="dataForm.arriveDate" placeholder="到样时间"></el-input>-->
          <!--          </el-form-item>-->
        </el-col>
        <el-col :span="12">
          <el-form-item label="检验时间" prop="provingTime">
            <el-date-picker v-model="dataForm.provingTimes" type="daterange" format="yyyy-MM-dd" placeholder="选择有效期"
                            range-separator="~" start-placeholder="开始时间" end-placeholder="结束时间" @change="handleDateChange(dataForm.provingTimes)" />
            <!--            <el-input v-model="dataForm.provingTime" placeholder="检验时间"></el-input>-->
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="检验地点" prop="checkGroundPoint">
            <el-input v-model="dataForm.checkGroundPoint" placeholder="检验地点"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="主要检测设备" prop="mainTestingEquipment">
            <el-input v-model="dataForm.mainTestingEquipment" placeholder="主要检测设备"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="检验依据" prop="checkAccording">
            <el-input v-model="dataForm.checkAccording" placeholder="检验依据"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="鉴定报告的签发日期" prop="issueDate">
            <el-date-picker style="width: 135px"
                            v-model="dataForm.issueDate"
                            type="datetime"
                            value-format="yyyy-MM-dd"
                            placeholder="选择日期时间">
            </el-date-picker>
            <!--            <el-input v-model="dataForm.issueDate" placeholder="鉴定报告的签发日期"></el-input>-->
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="样品图片(产品名称)" prop="pictureProductName">
            <file-upload upload-url="http://localhost:8088/reportApproval/report/fileUplod"
                         :value="dataForm.pictureProductName"
                         @change="(val) => dataForm.pictureProductName = val"
            ></file-upload>
          </el-form-item>
        </el-col>
      </el-row>
<!--      <el-col :span="12">-->
<!--        <el-form-item label="环境气温" prop="temperature">-->
<!--          <el-input v-model="dataForm.temperature" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
<!--      <el-col :span="12">-->
<!--        <el-form-item label="环境湿温" prop="humidity">-->
<!--          <el-input v-model="dataForm.humidity" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
<!--      <el-col :span="12">-->
<!--        <el-form-item label="土壤质地" prop="texture">-->
<!--          <el-input v-model="dataForm.texture" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
<!--      <el-col :span="12">-->
<!--        <el-form-item label="土壤坚实度" prop="texture">-->
<!--          <el-input v-model="dataForm.texture" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
<!--      <el-col :span="12">-->
<!--        <el-form-item label="土壤坚实度" prop="firmness">-->
<!--          <el-input v-model="dataForm.firmness" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
<!--      <el-col :span="12">-->
<!--        <el-form-item label="土壤含水率" prop="moisture">-->
<!--          <el-input v-model="dataForm.moisture" placeholder="产品名称"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-col>-->
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import FileUpload from "@/components/FileUpload.vue";

export default {
  components: {FileUpload},
  data() {
    return {
      visible: false,
      dataForm: {
        id: 0,
        productNumber: '',
        productName: '',
        producerName: '',
        sampleType: '',
        registeredAddress: '',
        sampleNum: '',
        manufactoryName: '',
        samplingBasicdate:'',
        sampleBernum: '',
        registeredAddressSample: '',
        productionDate: '',
        sampleGrade: '',
        sampleAcqMethod: '',
        samplingBasicNumber: '',
        samplingBasicDate: '',
        samplingBasicPlace: '',
        arriveDate: '',
        provingTime: '',
        provingTimes: '',
        checkGroundPoint: '',
        mainTestingEquipment: '',
        checkAccording: '',
        checkConclusion: '',
        issueDate: '',
        remark: '',
        reprotStatus: '',
        approver: '',
        approvalOpinion: '',
        auditor: '',
        auditOpinion: '',
        dateOfApproval: '',
        projectLeader: '',
        projectLeaderOpinion: '',
        projectLeaderDate: '',
        pictureProductName: '',
        pictureModel: '',
        remarks: '',
        reportWriter: '',
        reportDate: '',
        reportChecker: '',
        reportCheckerOpinion: '',
        reportCheckerDate: '',
        reportPath: '',
        pdfPath: '',
        temperature:'',
        humidity:'',
        texture:'',
        firmness:'',
        moisture:'',
        startProvingTime:'',
        endProvingTime:''
      },
      options: [],
      eoptions: [],
      dataRule: {
        productId: [
          {required: true, message: '产品id不能为空', trigger: 'blur'}
        ],
        productName: [
          {required: true, message: '样品名称不能为空', trigger: 'blur'}
        ],
        producerName: [
          {required: true, message: '生产者名称不能为空', trigger: 'blur'}
        ],
        sampleType: [
          {required: true, message: '样品型号不能为空', trigger: 'blur'}
        ],
        registeredAddress: [
          {required: true, message: '注册地址不能为空', trigger: 'blur'}
        ],
        sampleNum: [
          {required: true, message: '样品数量不能为空', trigger: 'blur'}
        ],
        manufactoryName: [
          {required: true, message: '生产厂名称不能为空', trigger: 'blur'}
        ],
        sampleBernum: [
          {required: true, message: '样品编号不能为空', trigger: 'blur'}
        ],
        registeredAddressSample: [
          {required: true, message: '样品注册地址不能为空', trigger: 'blur'}
        ],
        productionDate: [
          {required: true, message: '样品生产日期不能为空', trigger: 'blur'}
        ],
        sampleGrade: [
          {required: true, message: '样品等级不能为空', trigger: 'blur'}
        ],
        sampleAcqMethod: [
          {required: true, message: '样品取样方式不能为空', trigger: 'blur'}
        ],
        samplingBasicNumber: [
          {required: true, message: '抽样基数不能为空', trigger: 'blur'}
        ],
        samplingBasicDate: [
          {required: true, message: '抽样日期不能为空', trigger: 'blur'}
        ],
        samplingBasicPlace: [
          {required: true, message: '抽样地点不能为空', trigger: 'blur'}
        ],
        arriveDate: [
          {required: true, message: '到样时间不能为空', trigger: 'blur'}
        ],
        // provingTime: [
        //   {required: true, message: '检验时间不能为空', trigger: 'blur'}
        // ],
        checkGroundPoint: [
          {required: true, message: '检验地点不能为空', trigger: 'blur'}
        ],
        mainTestingEquipment: [
          {required: true, message: '主要检测设备不能为空', trigger: 'blur'}
        ],
        checkAccording: [
          {required: true, message: '检验依据不能为空', trigger: 'blur'}
        ],
        checkConclusion: [
          {required: true, message: '检验结论不能为空', trigger: 'blur'}
        ],
        remark: [
          {required: true, message: '备注不能为空', trigger: 'blur'}
        ],
        reprotStatus: [
          {required: true, message: '报告状态不能为空', trigger: 'blur'}
        ],
        approver: [
          {required: true, message: '批准人不能为空', trigger: 'blur'}
        ],
        approvalOpinion: [
          {required: true, message: '批准人意见不能为空', trigger: 'blur'}
        ],
        auditor: [
          {required: true, message: '审核人不能为空', trigger: 'blur'}
        ],
        auditOpinion: [
          {required: true, message: '审核人意见不能为空', trigger: 'blur'}
        ],
        dateOfApproval: [
          {required: true, message: '审核日期不能为空', trigger: 'blur'}
        ],
        projectLeader: [
          {required: true, message: '项目负责人不能为空', trigger: 'blur'}
        ],
        projectLeaderOpinion: [
          {required: true, message: '项目负责人意见不能为空', trigger: 'blur'}
        ],
        projectLeaderDate: [
          {required: true, message: '项目负责人填写日期不能为空', trigger: 'blur'}
        ],
        pictureProductName: [
          {required: true, message: '样品图片(产品名称)不能为空', trigger: 'blur'}
        ],
        pictureModel: [
          {required: true, message: '样品图片(产品型号)不能为空', trigger: 'blur'}
        ],
        remarks: [
          {required: true, message: '备注信息不能为空', trigger: 'blur'}
        ],
        reportWriter: [
          {required: true, message: '报告编写人不能为空', trigger: 'blur'}
        ],
        reportDate: [
          {required: true, message: '报告编写日期不能为空', trigger: 'blur'}
        ],
        reportChecker: [
          {required: true, message: '报告校核人不能为空', trigger: 'blur'}
        ],
        reportCheckerOpinion: [
          {required: true, message: '报告校核意见不能为空', trigger: 'blur'}
        ],
        reportCheckerDate: [
          {required: true, message: '报告校核日期不能为空', trigger: 'blur'}
        ],
        reportPath: [
          {required: true, message: '报告路径不能为空', trigger: 'blur'}
        ],
        pdfPath: [
          {required: true, message: 'pdf路径不能为空', trigger: 'blur'}
        ]
      }
    }
  },
  mounted() {
    this.getProductNumber()
    this.geteoptions()
  },
  methods: {
    handleDateChange(scope) {
      console.log("aaaa", scope)
      // 如果有效期是一个数组，格式化并更新表单数据
      if (scope.length === 2) {
        console.log("bbbb", scope[0])
        const startDate = scope[0];
        const endDate = scope[1];

        // 将格式化后的日期传入表单
        this.dataForm.provingTime = this.formatDate(startDate) + '~' + this.formatDate(endDate);
      }
    },
    formatDate(date) {
      if (!date) return '';
      const year = date.getFullYear();
      const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份从0开始
      const day = ('0' + date.getDate()).slice(-2);
      return `${year}-${month}-${day}`;
    },
    getEntrepreneurInfo() {
      this.$http({
        url: this.$http.adornUrl(`/reportapproval/entrepreneur/getCompanyNameInfo/${this.dataForm.producerName}`),
        method: 'get',
        data: this.$http.adornParams({})
      }).then((data) => {
        if (data && data.code === 0) {
          this.dataForm.registeredAddress = data.entrepreneur.address
          this.dataForm.manufactoryName = data.entrepreneur.name
          this.dataForm.registeredAddressSample = data.entrepreneur.address
          // this.dataForm.registeredAddressSample =data.entrepreneur.
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    geteoptions() {
      this.$http({
        url: this.$http.adornUrl('/reportapproval/entrepreneur/geteoptions'),
        method: 'get',
        data: this.$http.adornParams({})
      }).then((data) => {
        if (data && data.code === 0) {
          this.eoptions = data.entrepreneurList
          console.log(data.entrepreneurList)
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    getProductNumber() {
      this.$http({
        url: this.$http.adornUrl('/reportapproval/product/getProjectNumber'),
        method: 'get',
        data: this.$http.adornParams({})
      }).then((data) => {
        if (data && data.code === 0) {
          this.options = data.productList
          // console.log(this.options)
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    getProductInfo() {
      this.$http({
        url: this.$http.adornUrl(`/reportapproval/product/getProductInfo/${this.dataForm.productNumber}`),
        method: 'get',
        data: this.$http.adornParams({})
      }).then((data) => {
        if (data && data.code === 0) {
          this.dataForm.sampleType = data.productInfo.prProducerModel
          this.dataForm.productName = data.productInfo.prProjectName
          // this.dataForm.manufactoryName = data.productInfo.name
        } else {
          this.$message.error(data.msg)
        }
      })
      this.$http({
        url: this.$http.adornUrl(`/sampleSheet/getByProjectCode/${this.dataForm.productNumber}`),
        method: 'get',
      }).then(res => {
        if (res.code === 0 && res.data) {
          this.dataForm.sampleNum = res.data.samplingBasicNumber;
          this.dataForm.manufactoryName = res.data.manufactoryName
          this.dataForm.productionDate = res.data.sampleDetailsList[0].appearanceDate;
          this.dataForm.sampleBernum = res.data.sampleDetailsList.map(item => item.sampleNumber).join('\n');
          this.dataForm.sampleGrade = res.data.sampleGrade;
          this.dataForm.samplingBasicNumber = res.data.sampleNumber
        }
      })
      this.$http({
        url: this.$http.adornUrl(`/reportapproval/authenticationtask/getInfo/${this.dataForm.productNumber}`),
        method: 'get',
      }).then(res => {
        if (res.code === 0 && res.authenticationTask) {
          this.dataForm.checkAccording = res.authenticationTask.identificationBasis
        }
      })
      this.$http({
        url: this.$http.adornUrl(`/reportapproval/keyinstrument/getInfo/${this.dataForm.productNumber}`),
        method: 'get',
      }).then(res => {
        if (res.code === 0 && res.keyInstrument) {
          this.dataForm.mainTestingEquipment = res.keyInstrument
          // this.dataForm.checkAccording = res.authenticationTask.identificationBasis
        }
      })
    },
    formReset() {
      this.dataForm = {
        id: 0,
        productNumber: '',
        productName: '',
        producerName: '',
        sampleType: '',
        registeredAddress: '',
        sampleNum: '',
        manufactoryName: '',
        sampleBernum: '',
        registeredAddressSample: '',
        productionDate: '',
        sampleGrade: '',
        sampleAcqMethod: '',
        samplingBasicNumber: '',
        samplingBasicDate: '',
        samplingBasicPlace: '',
        arriveDate: '',
        provingTime: '',
        checkGroundPoint: '',
        mainTestingEquipment: '',
        checkAccording: '',
        checkConclusion: '',
        issueDate: '',
        remark: '',
        reprotStatus: '',
        approver: '',
        approvalOpinion: '',
        auditor: '',
        auditOpinion: '',
        dateOfApproval: '',
        projectLeader: '',
        projectLeaderOpinion: '',
        projectLeaderDate: '',
        pictureProductName: '',
        pictureModel: '',
        remarks: '',
        reportWriter: '',
        reportDate: '',
        reportChecker: '',
        reportCheckerOpinion: '',
        reportCheckerDate: '',
        reportPath: '',
        pdfPath: '',
      }
    },
    addItem(array, value = {}) {
      array.push(value);
    },
    delItem(array, index) {
      array.splice(index, 1);
    },
    init(id) {
      this.dataForm.id = id || 0
      this.visible = true
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
        if (this.dataForm.id) {
          this.$http({
            url: this.$http.adornUrl(`/reportApproval/report/info/${this.dataForm.id}`),
            method: 'post',
            params: this.$http.adornParams()
          }).then((data) => {
            if (data && data.code === 0) {
              this.dataForm.id = data.report.id
              this.dataForm.productNumber = data.report.productNumber
              this.dataForm.productModeName = data.report.productModeName
              this.dataForm.productProducer = data.report.productProducer
              this.dataForm.productManufacturingPlant = data.report.productManufacturingPlant
              this.dataForm.productName = data.report.productName
              this.dataForm.producerName = data.report.producerName
              this.dataForm.sampleType = data.report.sampleType
              this.dataForm.registeredAddress = data.report.registeredAddress
              this.dataForm.sampleNum = data.report.sampleNum
              this.dataForm.manufactoryName = data.report.manufactoryName
              this.dataForm.sampleBernum = data.report.sampleBernum
              this.dataForm.registeredAddressSample = data.report.registeredAddressSample
              this.dataForm.productionDate = data.report.productionDate
              this.dataForm.sampleGrade = data.report.sampleGrade
              this.dataForm.sampleAcqMethod = data.report.sampleAcqMethod
              this.dataForm.samplingBasicNumber = data.report.samplingBasicNumber
              this.dataForm.samplingBasicDate = data.report.samplingBasicDate
              this.dataForm.samplingBasicPlace = data.report.samplingBasicPlace
              this.dataForm.arriveDate = data.report.arriveDate
              this.dataForm.provingTime = data.report.provingTime
              this.dataForm.checkGroundPoint = data.report.checkGroundPoint
              this.dataForm.mainTestingEquipment = data.report.mainTestingEquipment
              this.dataForm.checkAccording = data.report.checkAccording
              this.dataForm.checkConclusion = data.report.checkConclusion
              this.dataForm.issueDate = data.report.issueDate
              this.dataForm.remark = data.report.remark
              this.dataForm.reprotStatus = data.report.reprotStatus
              this.dataForm.approver = data.report.approver
              this.dataForm.approvalOpinion = data.report.approvalOpinion
              this.dataForm.auditor = data.report.auditor
              this.dataForm.auditOpinion = data.report.auditOpinion
              this.dataForm.dateOfApproval = data.report.dateOfApproval
              this.dataForm.projectLeader = data.report.projectLeader
              this.dataForm.projectLeaderOpinion = data.report.projectLeaderOpinion
              this.dataForm.projectLeaderDate = data.report.projectLeaderDate
              this.dataForm.pictureProductName = data.report.pictureProductName
              this.dataForm.pictureModel = data.report.pictureModel
              this.dataForm.remarks = data.report.remarks
              this.dataForm.reportWriter = data.report.reportWriter
              this.dataForm.reportDate = data.report.reportDate
              this.dataForm.reportChecker = data.report.reportChecker
              this.dataForm.reportCheckerOpinion = data.report.reportCheckerOpinion
              this.dataForm.reportCheckerDate = data.report.reportCheckerDate
              this.dataForm.reportPath = data.report.reportPath
              this.dataForm.pdfPath = data.report.pdfPath
              this.dataForm.reportConditionVo = data.report.reportConditionVo
              this.dataForm.reportCheckResultVo = data.report.reportCheckResultVo
              this.dataForm.reportSampleSonsResultsVo = data.report.reportSampleSonsResultsVo
              this.dataForm.reportSampleConsSuitResultsVo = data.report.reportSampleConsSuitResultsVo
              this.dataForm.reportSampleSafetyResultsVo = data.report.reportSampleSafetyResultsVo
              this.dataForm.reportConsResultsVo = data.report.reportConsResultsVo
              this.dataForm.reportSampleSuitResultsVo = data.report.reportSampleSuitResultsVo
              this.dataForm.reportReliabilityResultVo = data.report.reportReliabilityResultVo
              this.dataForm.reportReliabilityConsResultVo = data.report.reportReliabilityConsResultVo
            }
          })
        }
      })
    },
    // 表单提交
    dataFormSubmit() {
      console.log(this.dataForm.provingTimes)
      if (this.dataForm.provingTimes && this.dataForm.provingTimes.length > 0) {
        this.dataForm.startProvingTime = this.dataForm.provingTimes[0];
        this.dataForm.endProvingTime = this.dataForm.provingTimes[1];
      }
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          this.$http({
            url: this.$http.adornUrl(`/reportApproval/report/${!this.dataForm.id ? 'save' : 'update'}`),
            method: 'post',
            data: this.$http.adornData({
              'id': this.dataForm.id || undefined,
              'productModeName': this.dataForm.productModeName,
              'productNumber': this.dataForm.productNumber,
              'productManufacturingPlant': this.dataForm.productManufacturingPlant,
              'productName': this.dataForm.productName,
              'producerName': this.dataForm.producerName,
              'sampleType': this.dataForm.sampleType,
              'registeredAddress': this.dataForm.registeredAddress,
              'sampleNum': this.dataForm.sampleNum,
              'manufactoryName': this.dataForm.manufactoryName,
              'sampleBernum': this.dataForm.sampleBernum,
              'registeredAddressSample': this.dataForm.registeredAddressSample,
              'productionDate': this.dataForm.productionDate,
              'sampleGrade': this.dataForm.sampleGrade,
              'sampleAcqMethod': this.dataForm.sampleAcqMethod,
              'samplingBasicNumber': this.dataForm.samplingBasicNumber,
              'samplingBasicDate': this.dataForm.samplingBasicDate,
              'samplingBasicPlace': this.dataForm.samplingBasicPlace,
              'arriveDate': this.dataForm.arriveDate,
              'provingTime': this.dataForm.provingTime,
              'checkGroundPoint': this.dataForm.checkGroundPoint,
              'mainTestingEquipment': this.dataForm.mainTestingEquipment,
              'checkAccording': this.dataForm.checkAccording,
              'checkConclusion': this.dataForm.checkConclusion,
              'issueDate': this.dataForm.issueDate,
              'remark': this.dataForm.remark,
              'reprotStatus': this.dataForm.reprotStatus,
              'approver': this.dataForm.approver,
              'approvalOpinion': this.dataForm.approvalOpinion,
              'auditor': this.dataForm.auditor,
              'auditOpinion': this.dataForm.auditOpinion,
              'dateOfApproval': this.dataForm.dateOfApproval,
              'projectLeader': this.dataForm.projectLeader,
              'projectLeaderOpinion': this.dataForm.projectLeaderOpinion,
              'projectLeaderDate': this.dataForm.projectLeaderDate,
              'pictureProductName': this.dataForm.pictureProductName,
              'pictureModel': this.dataForm.pictureModel,
              'remarks': this.dataForm.remarks,
              'reportWriter': this.dataForm.reportWriter,
              'reportDate': this.dataForm.reportDate,
              'reportChecker': this.dataForm.reportChecker,
              'reportCheckerOpinion': this.dataForm.reportCheckerOpinion,
              'reportCheckerDate': this.dataForm.reportCheckerDate,
              'reportPath': this.dataForm.reportPath,
              'pdfPath': this.dataForm.pdfPath,
              'reportConditionVo': this.dataForm.reportConditionVo,
              'reportCheckResultVo': this.dataForm.reportCheckResultVo,
              'reportSampleSonsResultsVo': this.dataForm.reportSampleSonsResultsVo,
              'reportSampleConsSuitResultsVo': this.dataForm.reportSampleConsSuitResultsVo,
              'reportSampleSafetyResultsVo': this.dataForm.reportSampleSafetyResultsVo,
              'reportConsResultsVo': this.dataForm.reportConsResultsVo,
              'reportSampleSuitResultsVo': this.dataForm.reportSampleSuitResultsVo,
              'reportReliabilityResultVo': this.dataForm.reportReliabilityResultVo,
              'reportReliabilityConsResultVo': this.dataForm.reportReliabilityConsResultVo
            })
          }).then((data) => {
            if (data && data.code === 0) {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.visible = false
                  this.$emit('refreshDataList')
                }
              })
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      })
    }
  }
}
</script>
